/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.vng.zing.survey.thrift.server;


import com.vng.zing.survey.thrift.service.SurveyService;
import org.apache.thrift.TProcessor;
import org.apache.thrift.server.TNonblockingServer;
import org.apache.thrift.server.TServer;
import org.apache.thrift.transport.TNonblockingServerSocket;
import org.apache.thrift.transport.TNonblockingServerTransport;

/**
 *
 * @author kienpd
 */
public class SurveyServiceMain {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
                int thriftPort =8081;
                SurveyServiceHandler handler = new SurveyServiceHandler();//tu tao
                TProcessor p = new SurveyService.Processor(handler);
                final TServer server;
                try {
                        TNonblockingServerTransport st = new TNonblockingServerSocket(thriftPort);
                        server = new TNonblockingServer(new TNonblockingServer.Args(st).processor(p));
                } catch(Exception e){
                        e.printStackTrace();
                       // logger_.error("WebServer:startThriftServer:err = " + e.getMessage(), e);
                        return;
                }
                server.serve(); 
                System.out.println("Thrift Server start...");
    }
}
